home *** CD-ROM | disk | FTP | other *** search
- /*
- ** This source code was written by Tim Endres
- ** Email: time@ice.com.
- ** USMail: 8840 Main Street, Whitmore Lake, MI 48189
- **
- ** Some portions of this application utilize sources
- ** that are copyrighted by ICE Engineering, Inc., and
- ** ICE Engineering retains all rights to those sources.
- **
- ** Neither ICE Engineering, Inc., nor Tim Endres,
- ** warrants this source code for any reason, and neither
- ** party assumes any responsbility for the use of these
- ** sources, libraries, or applications. The user of these
- ** sources and binaries assumes all responsbilities for
- ** any resulting consequences.
- */
-
- #include <Types.h>
- #include <Resources.h>
- #include <QuickDraw.h>
- #include <Windows.h>
- #include <Memory.h>
- #include <Files.h>
- #include "tcl.h"
- #include "xtcl.h"
-
- #define sprintf sprintf_drvr
- #define FALSE (Boolean)0
-
- void
- XTCLEntry(argc, argv, xpb)
- int argc;
- char **argv;
- XTCLParmBlk *xpb;
- {
- char buffer1[64];
- char buffer2[64];
- char buffer3[64];
- char buffer4[64];
- char pascal_name[256];
- Handle resultH;
- DateTimeRec cdate, mdate;
- ParamBlockRec pb;
- #pragma unused (argc)
-
- resultH = xpb->resultH;
-
- strcpy(pascal_name, argv[1]);
- c2pstr(pascal_name);
-
- pb.fileParam.ioCompletion = 0;
- pb.fileParam.ioVRefNum = 0;
- pb.fileParam.ioNamePtr = pascal_name;
- pb.fileParam.ioFDirIndex = 0;
- pb.fileParam.ioFVersNum = 0;
- PBGetFInfo(&pb, FALSE);
- if (pb.fileParam.ioResult != noErr) {
- sprintf(buffer1, "error #%d retrieving info for '%.32s'.",
- pb.fileParam.ioResult, argv[1]);
- SetHandleSize(resultH, strlen(buffer1) + 1);
- if (MemError() == noErr)
- strcpy(*resultH, buffer1);
- xpb->result = TCL_ERROR;
- }
- else {
- Secs2Date(pb.fileParam.ioFlCrDat, &cdate);
- Secs2Date(pb.fileParam.ioFlMdDat, &mdate);
- sprintf(buffer1, "'%4.4s' '%4.4s' %c%c%c%c%c%c%c",
- &pb.fileParam.ioFlFndrInfo.fdCreator, &pb.fileParam.ioFlFndrInfo.fdType,
- ( ((pb.fileParam.ioFlFndrInfo.fdFlags&0x8000)!=0) ? 'L' : 'l' ),
- ( ((pb.fileParam.ioFlFndrInfo.fdFlags&fInvisible)!=0) ? 'V' : 'v' ),
- ( ((pb.fileParam.ioFlFndrInfo.fdFlags&fHasBundle)!=0) ? 'B' : 'b' ),
- ( ((pb.fileParam.ioFlFndrInfo.fdFlags&0x1000)!=0) ? 'S' : 's' ),
- ( ((pb.fileParam.ioFlFndrInfo.fdFlags&0x0100)!=0) ? 'I' : 'i' ),
- ( ((pb.fileParam.ioFlFndrInfo.fdFlags&fOnDesk)!=0) ? 'D' : 'd' ),
- ( ((pb.fileParam.ioFlFndrInfo.fdFlags&0x0080)!=0) ? 'M' : 'm' )
- );
- sprintf(buffer2, "%02d/%02d/%02d %02d:%02d:%02d",
- cdate.month, cdate.day, cdate.year%100, cdate.hour, cdate.minute, cdate.second
- );
- sprintf(buffer3, "%02d/%02d/%02d %02d:%02d:%02d",
- mdate.month, mdate.day, mdate.year%100, mdate.hour, mdate.minute, mdate.second
- );
- sprintf(buffer4, "%d,%d %ld %ld",
- pb.fileParam.ioFlFndrInfo.fdLocation.h,
- pb.fileParam.ioFlFndrInfo.fdLocation.v,
- pb.fileParam.ioFlLgLen, pb.fileParam.ioFlRLgLen
- );
- SetHandleSize(resultH,
- (strlen(buffer1) + strlen(buffer2) +
- strlen(buffer3) + strlen(buffer4) + 2) );
- if (MemError() == noErr) {
- sprintf(*resultH, "%s %s %s %s", buffer1, buffer2, buffer3, buffer4);
- xpb->result = TCL_OK;
- }
- else {
- sprintf(buffer1, "not enough memory for result");
- SetHandleSize(resultH, strlen(buffer1) + 1);
- if (MemError() == noErr)
- strcpy(*resultH, buffer1);
- xpb->result = TCL_ERROR;
- }
- }
- }
-
-